FObjectPool Class Reference

FObjectPool allocates objects in blocks with MAX_USHORT elements per block. More...

#include <fmemory.h>

Public Member Functions

 FObjectPool (uint16 elementSize)
 Constructor.
 ~FObjectPool ()
 Destructor. Releases allocated memory back to the heap.
void * newElement ()
 allocate memory from within the preallocated memory block. If no more free entries are found, a new memory block is allocated.
void deleteElement (void *el)
 return element to the pool.

Detailed Description

FObjectPool allocates objects in blocks with MAX_USHORT elements per block.

FObjectPool can be used, if a lot of small equal sized elements are needed. Allocation and deallocation are fast and have little memory overhead. FObjectPool should not be used for large objects.

Memory is not released to the heap until the destructor of FBlockAllocator.

FObjectPool is thread safe, as it uses FLock to synchronize modifications.


Constructor & Destructor Documentation

FObjectPool ( uint16  elementSize  ) 

Constructor.

Parameters:
[in] elementSize : size of one element
~FObjectPool (  ) 

Destructor. Releases allocated memory back to the heap.


Member Function Documentation

void * newElement (  ) 

allocate memory from within the preallocated memory block. If no more free entries are found, a new memory block is allocated.

void deleteElement ( void *  el  ) 

return element to the pool.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.